﻿@implements IDisposable

<p></p>
<h6>网关首页</h6>
<p></p>

<Message @ref="MessageElement" />

<Row ItemsPerRow="ItemsPerRow.Three">
	<Card>
		<BodyTemplate>
			<Row ItemsPerRow="ItemsPerRow.One">
				<div>
					<div>实时统计: </div>
					<div>新建连接数: </div>
					<div>断开连接数: </div>
					<div>当前连接数: </div>
					<div>所有连接，从客户端接收数据字节数: </div>
					<div>所有连接，发送给客户端数据字节数: </div>
					@* <p></p> *@
					@* <Spinner Color="Color.Secondary" Size="Size.Small"></Spinner> *@
				</div>
			</Row>
		</BodyTemplate>
	</Card>
</Row>

<p></p>

@code
{
	System.Threading.Timer Timer { get; set; }
	Message MessageElement { get; set; }

	protected override Task OnInitializedAsync()
	{
		Timer = new System.Threading.Timer(new TimerCallback(async _ =>
		{
			await InvokeAsync(() => { StateHasChanged(); });

		}), null, 1000, 1000);

		return Task.CompletedTask;
	}

	void IDisposable.Dispose()
	{
		if (Timer != null)
		{
			Timer.Dispose();
			Timer = null;
		}
	}
}